- @no_container = true
- page_title "Labels"
- can_admin_label = can?(current_user, :admin_label, @group)
- issuables = ['issues', 'merge requests']
- search = params[:search]

- if can_admin_label
  - content_for(:header_content) do
    .nav-controls
      = link_to _('New label'), new_group_label_path(@group), class: "btn btn-new"

- if @labels.exists? || search.present?
  #promote-label-modal
  %div{ class: container_class }
    .top-area.adjust
      .nav-text
        = _('Labels can be applied to %{features}. Group labels are available for any project within the group.') % { features: issuables.to_sentence }
      .nav-controls
        = form_tag group_labels_path(@group), method: :get do
          .input-group
            = search_field_tag :search, params[:search], { placeholder: _('Filter'), id: 'label-search', class: 'form-control search-text-input input-short', spellcheck: false }
            %span.input-group-append
              %button.btn.btn-default{ type: "submit", "aria-label" => _('Submit search') }
                = icon("search")
        = render 'shared/labels/sort_dropdown'

    .labels-container.prepend-top-5
      - if @labels.any?
        .other-labels
          %h5= _('Labels')
          %ul.content-list.manage-labels-list.js-other-labels
            = render partial: 'shared/label', subject: @group, collection: @labels, as: :label, locals: { use_label_priority: false }
            = paginate @labels, theme: 'gitlab'
      - elsif search.present?
        .nothing-here-block
          = _('No labels with such name or description')
- else
  = render 'shared/empty_states/labels'

%template#js-badge-item-template
  %li.label-link-item.js-priority-badge.inline.prepend-left-10
    .label-badge.label-badge-blue= _('Prioritized label')
